# 登陆注册的相关业务逻辑都放在当前模块

from flask import Blueprint
from flask import redirect
from flask import request
from flask import session

admin_blu = Blueprint('admin', __name__)

from . import views


@admin_blu.before_request
def check_admin():
    # 如果不是管理员直接跳转到主页
    is_admin = session.get('is_admin',False)
    if not is_admin and not request.url.endswith('/admin/login'):
        return redirect('/')